﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Drawing;
using System.Drawing.Drawing2D;




namespace FXnaGis
{
    [Serializable]
    public class PolyStyle:Style
    {
        public PolyStyle()
        {

            this._outlineStyle = new LineStyle();

            this._pattern = new SimplePattern();

 
        }


        //静态变量

        public static PolyStyle DefaultStyle = new PolyStyle();




        bool _isDrawOutLine = true;

        /// <summary>
        /// 是否绘制外边线
        /// </summary>
        public bool IsDrawOutLine
        {
            get { return _isDrawOutLine; }
            set { _isDrawOutLine = value; }
        }


        bool _isFill = true;

        /// <summary>
        /// 是否填充
        /// </summary>
        public bool IsFill
        {
            get { return _isFill; }
            set { _isFill = value; }
        }




        LineStyle _outlineStyle;

        public LineStyle OutlineStyle
        {
            get { return _outlineStyle; }
            set { _outlineStyle = value; }
        }

        PolyPattern _pattern;

        public PolyPattern Pattern
        {
            get { return _pattern; }
            set { _pattern = value; }
        }



        /// <summary>
        /// Fills the specified graphics path with the pattern specified by this object
        /// </summary>
        /// <param name="g">The Graphics device to draw to</param>
        /// <param name="gp">The GraphicsPath that describes the closed shape to fill</param>
        public void FillPath(Graphics g, GraphicsPath gp)
        {

            if (!this._isFill)
            {
                return;
                
            }
            

            this._pattern.FillPath(g,gp);

 
        }

        /// <summary>
        /// Draws the borders for this graphics path by sequentially drawing all
        /// the strokes in the border symbolizer
        /// </summary>
        /// <param name="g">The Graphics device to draw to </param>
        /// <param name="gp">The GraphicsPath that describes the outline to draw</param>
        /// <param name="scaleWidth">The scaleWidth to use for scaling the line width </param>
       public  void DrawPath(Graphics g, GraphicsPath gp, double scaleWidth)
        {

            //在这里加入是否绘制边线的代码


            if (!this._isDrawOutLine)
            {
                return;


            }

            this._outlineStyle.DrawPath(g,gp,scaleWidth);
 
        }



    }
}
